<%@page import="cn.com.dhcc.app.core.CoreEnv.CoreInitCtx" %>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/view/common/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>


    <meta charset="utf-8"/>
    <title>${appname}</title>
    <%@ include file="/WEB-INF/view/common/css_js_ace.jsp" %>

    <script type="text/javaScript" src="${ctx}/static/js/jquery.selectlistactions.js"></script>
    <script type="text/javaScript" src="${ctx}/static/js/jquery.floatThead.min.js"></script>
    <!-- 必要的js文件 end -->
    <script type="text/javascript">
        var tabs = [];
        var tablesJson;
        var isExit = true;
        var mptype = ${dm.mappingType};
        var editFlag = '${editFlag}';
        var taskType = '${taskType}';
        var selectedTables = "";
        if(mptype == "1"){
             selectedTables = ${tablesJson};
        }
        var dsMappingId = '${vo.mpId}';


        var tableList = []; //所有选中表
        var icTableList = [];//所有有增量字段的选中表

        var tableCount = 0;
        var tableSelected = [];

        $(document).ready(function () {
            $('#btnRight').click(function (e) {
                if (editFlag == 0) {
                    alert("任务已交换过数据，不允许添加或删除发送表！");
                    return;
                }

                var tables = [];

                $('#source').find("option:selected").each(function () {
                    var table = {};
                    table.tableId = $(this).val();
                    table.tableName = $(this).text();
                    table.tableType = $(this).attr("tableType");
                    table.schema = $(this).attr("tableschema");
                    tables.push(table);
                });

                $('select').moveToListAndDelete('#source', '#destination');
                deselectOptions();
                disableButtons();

                showTables(tables);
                changeTitles();
                e.preventDefault();
            });

            $('#btnAllRight').click(function (e) {
                if (editFlag == 0) {
                    alert("任务已交换过数据，不允许添加或删除发送表！");
                    return;
                }

                var tables = [];

                $('#source').find("option").each(function () {
                    var table = {};
                    table.tableId = $(this).val();
                    table.tableName = $(this).text();
                    table.tableType = $(this).attr("tableType");
                    table.schema = $(this).attr("schemaName");
                    tables.push(table);
                });

                $('select').moveAllToListAndDelete('#source', '#destination');
                deselectOptions();
                disableButtons();
                showTables(tables);
                changeTitles();
                e.preventDefault();
            });

            $('#btnLeft').click(function (e) {
                if (editFlag == 0) {
                    alert("任务已交换过数据，不允许添加或删除发送表！");
                    return;
                }

                var ids = [];

                $('#destination').find("option:selected").each(function () {
                    ids.push($(this).val());
                });

                deleteFromTable(ids);

                $('select').moveToListAndDelete('#destination', '#source');
                deselectOptions();
                disableButtons();
                changeTitles();
                e.preventDefault();
            });

            $('#btnAllLeft').click(function (e) {
                if (editFlag == 0) {
                    alert("任务已交换过数据，不允许添加或删除发送表！");
                    return;
                }

                var ids = [];

                $('#destination').find("option").each(function () {
                    ids.push($(this).val());
                });

                deleteFromTable(ids);

                $('select').moveAllToListAndDelete('#destination', '#source');
                deselectOptions();
                disableButtons();
                changeTitles();
                e.preventDefault();
            });

            //搜索框
            //$('#source').filterByText($('#filter_source'), true);
            //$('#destination').filterByText($('#filter_destination'), true);

            $('#source').on('change', '', function (e) {
                var len = $('#source').find("option:selected").length;
                if (len != 0) {
                    $('#btnRight').attr("disabled", false);
                } else {
                    $('#btnRight').attr("disabled", true);
                }
            });

            $('#destination').on('change', '', function (e) {
                var len = $('#destination').find("option:selected").length;
                if (len != 0) {
                    $('#btnLeft').attr("disabled", false);
                } else {
                    $('#btnLeft').attr("disabled", true);
                }
            });

            if (mptype == "1") {
                $("#settSpan").css("display", "");
                fixedHeadTable();
            }
            $("#conf_" + mptype).css("display", "");

            $("#ds_mapping").on('change', '', function (e) {
                $("#conf_1").css("display", "none");
                $("#conf_3").css("display", "none");
                $("#settSpan").css("display", "none");
                $("#isSett").prop("checked", false);
                if (this.value != '') {
                    var type = $(this.selectedOptions).attr("mptype");
                    $("#conf_" + type).css("display", "");
                    if (type == 1) {
                        $("#settSpan").css("display", "");
                        changeTable(this.value);
                    }

                }
            })
        })

        function fixedHeadTable() {
            var $table = $('.wrapper table');

            $table.floatThead({
                //useAbsolutePositioning: true,
                scrollContainer: function ($table) {
                    return $table.closest('.wrapper');
                }
            });
        }

        function deselectOptions() {
            $('#destination').find("option:selected").each(function () {
                $(this).prop("selected", false);
            });

            $('#source').find("option:selected").each(function () {
                $(this).prop("selected", false);
            });
        }

        $(function () {
            $(window).bind('beforeunload', function () {
                if (isExit) {
                    return '您输入的内容尚未保存，确定离开此页面吗？';
                }
            });
            $('.tipMe').tooltip({
                'placement': 'top'
            });
            //$('#inputForm input').tooltip({'placement':'top'});
            $('#inputForm input').tooltip();
            //表单验证
            $('#inputForm').checkForm(sub);
            $('#inputForm').ajaxForm({
                url: _ctx + "/task/update_task.do",
                type: "post",
                dataType: "json",
                beforeSubmit: function () {
                    $("#sbmBtn").attr("disabled", "disabled");
                },
                clearForm: false,
                resetForm: false,
                success: function (resp) {
                    if (resp.status == '1') {
                        isExit = false;
                        parent.ui.msg(resp.msg, 1);
                        ui.go(_ctx + '/task/task_list.do');
                    } else {
                        parent.ui.msg(resp.msg, 0);
                    }
                    $("#sbmBtn").removeClass("disabled").attr("disabled", null);
                },
                error: function (resp) {
                    parent.ui.msg('请求发送失败', 0);
                    $("#sbmBtn").removeClass("disabled").attr("disabled", null);
                }
            });

            if (taskType == "1") {
                $('#freq_div').hide();
            }

            //加载任务频率
            changeTaskType(${vo.taskFreqType});
            if (taskType == '2') {
                var freq = '${period.freq}';
                var intervalVallue = '${period.intervalVallue}';
                if (freq == 1) {
                    $("#intervalVallue1").val(intervalVallue);
                } else {
                    $("#intervalVallue" + freq).val(intervalVallue);
                    $("#executeTime" + freq).val('${period.executeTime}');
                }
            }

            //加载选中表
            loadTableSelect();


        });

        function disableButtons() {

            var lengthOfLeftSelected = $('#source').find("option:selected").length;
            var lengthOfRightSelected = $('#destination').find("option:selected").length;
            var lengthOfLeft = $('#source').children('option').length;
            var lengthOfRight = $('#destination').children('option').length;

            if (lengthOfLeftSelected != 0) {
                $('#btnRight').attr("disabled", false);
            } else {
                $('#btnRight').attr("disabled", true);
            }

            if (lengthOfRightSelected != 0) {
                $('#btnLeft').attr("disabled", false);
            } else {
                $('#btnLeft').attr("disabled", true);
            }

            if (lengthOfLeft == 0) {
                $('#btnAllRight').attr("disabled", true);
            } else {
                $('#btnAllRight').attr("disabled", false);
            }

            if (lengthOfRight == 0) {
                $('#btnAllLeft').attr("disabled", true);
            } else {
                $('#btnAllLeft').attr("disabled", false);
            }
        }

        function disableSelect() {
            $('#btnRight').attr("disabled", true);
            $('#btnLeft').attr("disabled", true);
            $('#btnAllRight').attr("disabled", true);
            $('#btnAllLeft').attr("disabled", true);
        }

        function editSelect() {
            //如果任务已经执行过，提示
            if (editFlag == 0) {
                alert("任务已交换过数据，不允许添加或删除发送表！");
                return;
            }
            $("#table_select_list").show();
            $("#table_select_table").hide();
        }

        function showTables(tables) {
            tableList = tables;
            var tbody = "";
            for (var count = 0; count < tables.length; count++) {
                var isIc = "无";
                var intervalCell = "-";
                var tableNum = tableCount + count;
                if (tables[count].tableType == '1') {
                    isIc = "有";
                    intervalCell = "<div class='visible-md visible-lg hidden-sm hidden-xs action-buttons'>"
                        + "<input class='endValue' type='hidden' name='tables[" + tableNum + "].endValue'>"
                        + "<input class='startValue' type='hidden' name='tables[" + tableNum + "].startValue'>"
                        + "<a class='blue' tableId="
                        + tables[count].tableId
                        + " onclick='showInterval(this)' title='查看'>"
                        + "<i class='icon-zoom-in bigger-130'></i>"
                        + "</a>"
                        + "<a class='blue' tableId="
                        + tables[count].tableId
                        + " onclick='editInterval(this)' title='修改'>"
                        + "<i class='icon-pencil bigger-130'></i>"
                        + "</a>"
                        + "</div>";
                    icTableList.push(tables[count]);
                }

                tbody += "<tr id=" + tables[count].tableId + ">"
                    + "<td class='center' width='5%'>"
                    + "<label>"
                    + "<input type='checkbox' class='ace' onclick='changeDestination(this);' value='" + tables[count].tableId + "'/>"
                    + "<span class='lbl'></span>"
                    + "</label>"
                    + "</td>"
                    + "<td class='center table_name' width='25%'>"
                    + "<input type='hidden' name='tables[" + tableNum + "].tableId' value=" + tables[count].tableId + ">"
                    + "<input type='hidden' name='tables[" + tableNum + "].tabOrder' value=" + tableNum + ">"
                    + tables[count].tableName
                    + "</td>"
                    + "<td class='center' width='15%'>"
                    + tables[count].schema
                    + "</td>"
                    + "<td class='center' width='13%'>"
                    + isIc
                    + "</td>"
                    + "<td class='center' width='13%'>"
                    + "<div class='visible-md visible-lg hidden-sm hidden-xs action-buttons'>"
                    + "<a class='blue' tableId="
                    + tables[count].tableId
                    + " onclick='showColInfo(this)' title='查看'>"
                    + "<i class='icon-zoom-in bigger-130'></i>"
                    + "</a>"
                    + "</div>"
                    + "</td>"
                    + "<td class='center' width='13%'>"
                    + intervalCell
                    + "</td>"
                    + "<td class='center' width='16%'>"
                    + "<div class='visible-md visible-lg hidden-sm hidden-xs action-buttons'>"
                    + "<input class='WhereCondition' type='hidden' name='tables[" + tableNum + "].whereCondition'>"
                    + "<a class='blue' tableId="
                    + tables[count].tableId
                    + " onclick='showWhereCondition(this)' title='查看'>"
                    + "<i class='icon-zoom-in bigger-130'></i>"
                    + "</a>"
                    + "<a class='blue' tableId="
                    + tables[count].tableId
                    + " onclick='editWhereCondition(this)' title='修改'>"
                    + "<i class='icon-pencil bigger-130'></i>"
                    + "</a>"
                    + "</div>"
                    + "</td>" + "</tr>";
            }

            $('#table_table_body').append(tbody);
            tableCount += tables.length;
            tableSelected = tables;
            parent.$("#tableSelectModal").modal("hide");
        }

        function deleteFromTable(ids) {
            for (var i = 0; i < ids.length; i++) {
                $('#' + ids[i]).remove();
            }

            var newTableSelected = [];

            for (var i = 0; i < tableSelected.length; i++) {
                var tabId = tableSelected[i].tableId;
                if ($.inArray(tabId, ids) == -1) {
                    newTableSelected.push(tableSelected[i]);
                }
            }

            var tempCount = tableCount - ids.length;
            tableCount = 0;
            $('#table_table_body').html("");
            showTables(newTableSelected);
            tableCount = tempCount;
        }

        function loadTableSelect() {
            //加载所有table
            $.ajax({
                type: "GET",
                dataType: "json",
                cache: false,
                url: _ctx + "/task/change_table.do",
                asyn: false,
                data: {
                    dsMappingId: dsMappingId,
                },
                success: function (resp) {
                    if (resp.status == '1') {
                        var tabs = resp.data;
                        for (var count = 0; count < tabs.length; count++) {
                            var id = tabs[count].id;
                            var name = tabs[count].tableName;
                            var tableType = tabs[count].tableType;

                            var option = "<option value='" + tabs[count].id + "' tableType='" + tabs[count].tableType + "' tableSchema='" + tabs[count].schema + " '>" + tabs[count].tableName + "</option>";
                            $('#source').append($(option));
                        }

                    } else {
                        parent.ui.msg(resp.msg, 0);
                    }

                },
                error: function () {
                    ui.msg('信息加载错误', 0);
                }
            }).done(function () {
                if (mptype == 1) {
                    //选中已有表
                    var tables = [];
                    for (var i = 0; i < selectedTables.length; i++) {
                        var id = selectedTables[i].tableId;
                        var name = selectedTables[i].tableName;
                        var whereCondition = selectedTables[i].whereCondition;
                        var type = selectedTables[i].tableType;
                        var start = selectedTables[i].startValue;
                        var end = selectedTables[i].endValue;
                        var schema = selectedTables[i].schema;
                        $('#source option[value = ' + id + ']').attr('selected', 'selected');

                        var table = {};
                        table.tableId = id;
                        table.tableName = name;
                        table.whereCondition = whereCondition;
                        table.tableType = type;
                        table.startValue = start;
                        table.endValue = end;
                        table.schema = schema;
                        tables.push(table);
                    }

                    $('select').moveToListAndDelete('#source', '#destination');

                    //加载已选中表
                    showTables(tables);

                    $('#destination').find("option:selected").each(function () {
                        $(this).prop("selected", false);
                    });

                    changeTitles();
                    disableButtons();
                }
            });


        }

        function changeDomain(value) {
            var tableURL = _ctx + "/task/change_domain.do?domainId=" + value;
            $.jsonAjaxSelect("dc_select", tableURL, "id", "name", false);
        }

        function changeTable(value) {
            if (editFlag == 0) {
                alert("任务已交换过数据，不允许修改数据映射！");
                $("#ds_mapping").find("option[value='${vo.mpId}']").prop("selected", true);
                return;
            }

            $.ajax({
                type: "GET",
                dataType: "json",
                cache: false,
                url: _ctx + "/task/change_table.do",
                asyn: false,
                data: {
                    dsMappingId: value,
                },
                success: function (resp) {
                    if (resp.status == '1') {
                        var tabs = resp.data;
                        for (var count = 0; count < tabs.length; count++) {
                            var id = tabs[count].id;
                            var name = tabs[count].tableName;
                            var tableType = tabs[count].tableType;
                            var schemaName = tabs[count].schema;
                            var option = "<option value='" + id + "' tableType='" + tableType + "' schemaName='"+schemaName+"'>" + name + "</option>";
                            $('#source').append($(option));
                        }

                    } else {
                        parent.ui.msg(resp.msg, 0);
                    }

                },
                error: function () {
                    ui.msg('信息加载错误', 0);
                }
            }).done(function () {
                disableButtons();

                $('#table_table_body').empty();
                changeTitles();
            });
        }

        function changeDestination(obj) {
            if ($(obj).attr("id") == "checkedAll") {
                $('#destination').find('option').each(function () {
                    if ($(obj).is(':checked')) {
                        $(this).prop('selected', 'selected');
                    } else {
                        $(this).prop('selected', false);
                    }
                });
            } else {
                var id = $(obj).attr("value");
                if ($(obj).is(':checked')) {
                    $('#destination option[value="' + id + '"]').prop('selected', 'selected');
                } else {
                    $('#destination option[value="' + id + '"]').prop('selected', false);
                }
            }

            disableButtons();

        }

        function changeTitles() {
            var sourceNum = $('#source').find('option').length;
            var destNum = $('#table_table_body').find('tr').length;
            var sourceTitle = "源端数据对象列表（共" + sourceNum + "）";
            var destTitle = "已选择抽取对象（共" + destNum + "）";

            $('#source_title').html(sourceTitle);
            $('#dest_title').html(destTitle);
        }

        function showColInfo(obj) {
            var id = $(obj).attr("tableId");
            $.ajax({
                type: "POST",
                dataType: "html",
                cache: false,
                url: _ctx + "/task/get_table_col.do",
                data: {
                    tableId: id,
                },
                success: function (content) {
                    $("#tableDiv").html(content);
                    var hiddenByClick = false;
                    window.parent.iframeModal("tableModal", $("#tempDiv").html(),
                        hiddenByClick);
                },
                error: function () {
                    ui.msg('信息加载错误', 0);
                }
            });
        }

        function showWhereCondition(obj) {
            $('#WhereCell').empty();
            var condition = $(obj).prev().val();
            $('#WhereCell').html(condition);
            var hiddenByClick = false;
            window.parent.iframeModal("tableModal", $("#WhereShowDiv").html(),
                hiddenByClick);
        }

        function showInterval(obj) {
            var id = $(obj).attr("tableId");

            $('#StartValueCell').empty();
            $('#StartValueCell').empty();

            var startValue = $(obj).prev().val();
            var endValue = $(obj).prev().prev().val();
            $('#StartValueCell').html(startValue);
            $('#EndValueCell').html(endValue);

            var hiddenByClick = false;
            window.parent.iframeModal("intervalShowModal", $("#IntervalShowDiv").html(),
                hiddenByClick);
        }

        function editWhereCondition(obj) {
            var id = $(obj).attr("tableId");
            var oldWhere = $(obj).prev().prev().val();
            var dsMappingId = $('#ds_mapping').val();
            /* var oldStart = $(obj).prev().prev().val();
             var oldEnd = $(obj).prev().prev().prev().prev().val();
             var executeType = $('input[name=taskFreqType]:checked').val(); */
            $.ajax({
                type: "POST",
                dataType: "html",
                cache: false,
                url: _ctx + "/task/edit_where.do",
                data: {
                    tableId: id,
                    oldWhere: oldWhere,
                    mappingId: dsMappingId
                },
                success: function (content) {
                    $("#tableDiv_2").html(content);
                    var hiddenByClick = false;
                    window.parent.iframeModal("WhereEditModal", $("#WhereEditDiv").html(),
                        hiddenByClick);
                },
                error: function () {
                    parent.ui.msg('信息加载错误', 0);
                }
            });
        }

        function editInterval(obj) {
            var id = $(obj).attr("tableId");
            var oldStart = $(obj).prev().prev().val();
            var oldEnd = $(obj).prev().prev().prev().val();
            var executeType = taskType;

            $.ajax({
                type: "POST",
                dataType: "html",
                cache: false,
                url: _ctx + "/task/edit_interval.do",
                data: {
                    tableId: id,
                    oldStartValue: oldStart,
                    oldEndValue: oldEnd,
                    taskType: taskType
                },
                success: function (content) {
                    $('#tableDiv_4').html(content);
                    var hiddenByClick = false;
                    window.parent.iframeModal("IntervalEditModal", $("#IntervalEditDiv").html(),
                        hiddenByClick);
                },
                error: function () {
                    parent.ui.msg('信息加载错误', 0);
                }
            });
        }

        function saveWhereEdit(obj, isAll) {
            var where_content = parent.$('#where_edit_field').val();

            //为其他表进行相同配置
            if (isAll) {
                for (var count = 0; count < tableList.length; count++) {
                    var id = tableList[count].tableId;
                    $('#' + id).find('input.WhereCondition').attr("value", where_content);
                }
            } else {
                var id = $(obj).attr("tableId");
                $('#' + id).find('input.WhereCondition').attr("value", where_content);
            }


            //查看哪一个被显示
            // if(parent.$('#ic_start_value_div').is(":visible")) {
            // if(parent.$('#start_date_pick').is(":visible")) {
            // var startValue = parent.$('#start_date').val();
            // var endValue = parent.$('#end_date').val();
            // $('#' + id).find('input.startValue').attr("value", startValue);
            // $('#' + id).find('input.endValue').attr("value", endValue);
            // } else {
            // var startValue = parent.$('#start_text').val();
            // var EndValue = parent.$('#end_text').val();
            // $('#' + id).find('input.startValue').attr("value", startValue);
            // $('#' + id).find('input.endValue').attr("value", EndValue);
            // }
            // }


            parent.$("#WhereEditModal").modal("hide");
        }

        function saveIntervalEdit(obj, isAll) {
            var startValue = "";
            var endValue = "";

            //查看哪一个被显示
            if (parent.$('#ic_start_value_div').is(":visible")) {
                if (parent.$('#start_date_pick').is(":visible")) {
                    startValue = parent.$('#start_date').val();
                    endValue = parent.$('#end_date').val();

                } else {
                    startValue = parent.$('#start_text').val();
                    endValue = parent.$('#end_text').val();
                }
            }

            if (isAll) {
                for (var count = 0; count < icTableList.length; count++) {
                    var id = icTableList[count].tableId;
                    $('#' + id).find('input.startValue').attr("value", startValue);
                    $('#' + id).find('input.endValue').attr("value", endValue);
                }

            } else {
                var id = $(obj).attr("tableId");
                $('#' + id).find('input.startValue').attr("value", startValue);
                $('#' + id).find('input.endValue').attr("value", endValue);
            }

            parent.$("#IntervalEditModal").modal("hide");
        }

        function addTables() {
            var dsMappingId = $('#ds_mapping').val();
            if (dsMappingId == "" || dsMappingId == null) {
                alert("请选择数据源映射");
                return;
            }

            $.ajax({
                type: "POST",
                dataType: "html",
                cache: false,
                url: _ctx + "/task/select_table.do",
                data: {
                    dsMappingId: dsMappingId
                },
                success: function (content) {
                    $("#tableDiv_3").html(content);
                    var hiddenByClick = false;
                    window.parent.iframeModal("tableSelectModal", $("#selectModalDiv").html(),
                        hiddenByClick);
                },
                error: function () {
                    parent.ui.msg('信息加载错误', 0);
                }
            });
        }


        var sqlTestFlag = 1;

        function sub() {
            //检查发送频率设置
            if (taskType == '2') {//检查周期性任务设置
                var freq = $("input[name='freq']:checked").val();
                var intervalVallue;
                var executeTime;
                if (freq == 1) {
                    if ($("#intervalVallue1").val() == ''
                        || $("#intervalVallue1").val() == null) {
                        alert("间隔时间不能空");
                        return false;
                    }
                    intervalVallue = $("#intervalVallue1").val()
                        * $("#intervalVallue1Type").val();
                } else {
                    if ($("#executeTime" + freq).val() == null
                        || $("#executeTime" + freq).val() == '') {
                        alert("执行时间不能为空");
                        return false;
                    }
                    executeTime = $("#executeTime" + freq).val();
                    intervalVallue = $("#intervalVallue" + freq).val();
                    $("#periodExecuteTime").val(executeTime);
                }
                $("#intervalVallue").val(intervalVallue);
                $("#extrEndTime").val("");
            }

            //检查定时发送时间
            if ($("input[name='executeType']:checked").val() == 3) {
                if ($("#ontimeExecuteTime").val() == ''
                    || $("#ontimeExecuteTime").val() == null) {
                    alert("定时发送时间不能为空");
                    return false;
                }
            }

            //检查截止时间
            if ($("input[name='cutOffTimeType']:checked").val() == 1) {
                $("#cutOffTime").val("");
            } else {
                if ($("#cutOffTime").val() == "" || $("#cutOffTime").val() == null) {
                    alert("截止时间不能空");
                    return false;
                }
            }
            var dm = $("#ds_mapping")[0];
            var mptype = $(dm.selectedOptions).attr("mptype")
            if(mptype == 1){
                if ($('#table_table_body').children('tr').length == 0) {
//                alert('请选择发送表!');
                    parent.ui.msg("请选择发送表", 0);
                    return false;
                }
            }else if(mptype == 3){
                var filterType = $("input:radio[name='filterType']:checked").val();
                var filterValue = $("#filterValue"+filterType).val();

                if(filterValue == ""){
                    alert("请输入过滤条件");
//                parent.ui.msg("请输入过滤条件", 0);
                    return false;
                }
                $("#filterValue").val(filterValue);
                var maxType = $("input[name='maxType']:checked").val();
                if(maxType == 1){
                    $("#sizeMax").val("");
                }
            }
        }

        function changeTaskType(idx) {
            /* if (idx == 2) {
             $("input[name='freq']").removeClass("disabled").attr("disabled",
             null);
             $("input[name='executeType']").attr("disabled", "disabled");
             $("#ontimeExecuteTime").attr("disabled", "disabled");
             $("#intervalVallue1").removeClass("disabled")
             .attr("disabled", null);
             $("#intervalVallue2").removeClass("disabled")
             .attr("disabled", null);
             $("#intervalVallue3").removeClass("disabled")
             .attr("disabled", null);
             $("#intervalVallue4").removeClass("disabled")
             .attr("disabled", null);
             $("#executeTime2").removeClass("disabled").attr("disabled", null);
             $("#executeTime3").removeClass("disabled").attr("disabled", null);
             $("#executeTime4").removeClass("disabled").attr("disabled", null);
             $("#intervalVallue1Type").removeClass("disabled").attr("disabled",
             null);
             $("#cutOffTimeType1").removeClass("disabled")
             .attr("disabled", null);
             $("#cutOffTimeType2").removeClass("disabled")
             .attr("disabled", null);
             $("#cutOffTime").removeClass("disabled").attr("disabled", null);
             if ($("input[name='cutOffTimeType']:checked").val() == 1) {
             $("#cutOffTime").attr("disabled", "disabled");
             }
             $("#ontimeDataEndTime").css("display", "none");
             } else {
             $("input[name='executeType']").removeClass("disabled").attr(
             "disabled", null);
             $("input[name='freq']").attr("disabled", "disabled");
             $("#intervalVallue1").attr("disabled", "disabled");
             $("#intervalVallue2").attr("disabled", "disabled");
             $("#intervalVallue3").attr("disabled", "disabled");
             $("#intervalVallue4").attr("disabled", "disabled");
             $("#executeTime2").attr("disabled", "disabled");
             $("#executeTime3").attr("disabled", "disabled");
             $("#executeTime4").attr("disabled", "disabled");
             $("#intervalVallue1Type").attr("disabled", "disabled");
             $("#cutOffTimeType1").attr("disabled", "disabled");
             $("#cutOffTimeType2").attr("disabled", "disabled");
             $("#cutOffTime").attr("disabled", "disabled");
             if ($("input[name='executeType']:checked").val() == '3') {
             $("#ontimeExecuteTime").removeClass("disabled").attr(
             "disabled", null);
             } else {
             $("#ontimeExecuteTime").attr("disabled", "disabled");
             }
             $("#ontimeDataEndTime").css("display", "");
             $("#extrEndTime").val("");
             } */
        }
        function changeCutOffTimeType(idx) {
            if (idx == 1) {
                $("#cutOffTime").attr("disabled", "disabled");
            } else {
                $("#cutOffTime").removeClass("disabled").attr("disabled", null);
            }
        }
        function changeExecuteType() {
            if ($("input[name='executeType']:checked").val() == 3) {
                $("#ontimeExecuteTime").removeClass("disabled").attr("disabled",
                    null);
            } else {
                $("#ontimeExecuteTime").attr("disabled", "disabled");
            }
        }
        function tableSqlTest(submitFlag) {
            var sql = $("#tableName").val() + " " + $("#whereCondition").val();
            $.ajax({
                type: "POST",
                url: _ctx + "/structured/table_sql_test.do",
                async: false,
                cache: false,
                data: {
                    dsId: $("#dsId").val(),
                    schema: $("#schemaName").val(),
                    testSql: sql,
                    dsUsername: $("#dsUsername").val(),
                    dsPasswd: $("#dsPasswd").val()
                },
                beforeSend: function () {
                    $("#testSqlBtn").val("正在验证...").attr("disabled", "disabled");
                },
                success: function (data) {
                    if (data.status == 0) {
                        alert(data.msg);
                        if (submitFlag) {
                            sqlTestFlag = 0;
                        }
                    } else {
                        if (submitFlag) {
                            sqlTestFlag = 1;
                        } else {
                            alert(data.msg);
                        }
                    }
                    $("#testSqlBtn").val("验证发布信息").attr("disabled", null);
                },
                error: function () {
                    alert('系统异常,操作失败');
                    $("#testSqlBtn").val("验证发布信息").attr("disabled", null);
                }
            });
        }
        function checkIsSett() {
            if ($("#freq1").is(':checked')) {
                if ($("#intervalVallue1").val() == '' || $("#intervalVallue1").val() == null) {
                    alert("间隔时间不能空");
                    $("#isSett").prop("checked", false);
                }
                var intervalVallue = $("#intervalVallue1").val() * $("#intervalVallue1Type").val();
                if (intervalVallue > 60 * 60 * 12) {
                    alert("结算功能只能用于小于间隔12小时的周期性任务.");
                    $("#isSett").prop("checked", false);
                }
            } else {
                alert("结算功能只能用于小于间隔12小时的周期性任务.");
                $("#isSett").prop("checked", false);
            }
        }
    </script>
</head>
<body style="overflow-y: hidden;">
<div class="main-container" id="main-container">
    <div class="main-container-inner">
        <div class="main-content" style="margin-left: 0px;">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li><i class="icon-home home-icon"></i> 首页</li>
                    <li>ETL任务管理</li>
                    <c:choose>
                        <c:when test="${taskType eq 1}">
                            <li>更新一次性任务</li>
                        </c:when>
                        <c:otherwise>
                            <li>更新周期性任务</li>
                        </c:otherwise>
                    </c:choose>
                </ul>
            </div>
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="widget-main">
                            <div class="widget-box" style="border-bottom:0;">
                                <div class="widget-header widget-header-flat">
                                    <div class="widget-toolbar no-border">
                                        <a class="btn btn-primary btn-xs"
                                           href="${ctx}/task/task_list.do"><i
                                                class="icon-arrow-left"></i> 返回&nbsp;&nbsp;</a>
                                    </div>
                                </div>
                                <form class="form-horizontal" role="form" id="inputForm" action="" method="post">
                                    <div class="widget-box transparent">
                                        <div class="widget-header">
                                            <h6 class="lighter blue">路由信息配置</h6>
                                        </div>

                                        <div class="widget-body">
                                            <div class="widget-main no-padding-left no-padding-right">
                                                <div class="row">
                                                    <div class="table-responsive">
                                                        <div class="row">
                                                            <div class="col-xs-12">
                                                                <div class="widget-main">
                                                                    <div class="profile-user-info profile-user-info-striped"
                                                                         id="taskInfo">
                                                                        <div class="profile-info-row"
                                                                             style="height: 45px;">
                                                                            <input type="hidden" id="id" name="id"
                                                                                   value="${vo.id }">
                                                                            <input type="hidden" id="status"
                                                                                   name="status" value="${vo.status }">
                                                                            <div class="profile-info-name"
                                                                                 style="padding-top: 15px;">
                                                                                任务名称
                                                                            </div>
                                                                            <div class="profile-info-value">
																					<span class="editable"> 
																					<input type="text"
                                                                                           class="col-xs-10 col-sm-3"
                                                                                           name="taskName" id="taskName"
                                                                                           value="${vo.taskName}"
                                                                                           style="width:35%;"
                                                                                           datatype="require|ajax|safeString2"
                                                                                           url="${ctx }/task/is_taskName_unique.do"
                                                                                           oldValue="${vo.taskName}"
                                                                                           title="必填项,任务名称"
                                                                                           placeholder="请输入任务名称"
                                                                                           msg="请输入任务名称|任务名称重复|不允许输入特殊字符"/>
																					<span class="lbl">&nbsp;</span> </span>
                                                                            </div>
                                                                        </div>
                                                                        <div class="profile-info-row"
                                                                             style="height: 45px;">
                                                                            <div class="profile-info-name"
                                                                                 style="padding-top: 15px;">所属数据分类
                                                                            </div>
                                                                            <div class="profile-info-value">
																					<span class="editable">
																						<select id="domain"
                                                                                                name="domain"
                                                                                                class="col-xs-8 col-sm-2"
                                                                                                datatype="require"
                                                                                                msg="选择业务域"
                                                                                                onchange="changeDomain(this.value);">
																							<option value="">-请选择业务域-</option>
																							<c:forEach var="domain"
                                                                                                       items="${domains}">
                                                                                                <option value="${domain.id}"
                                                                                                        <c:if test="${vo.domainId eq domain.id}">selected="selected"</c:if>>${domain.name}</option>
                                                                                            </c:forEach>
																						</select> 
																						
																						<select id="data_cata"
                                                                                                name="dateCategoryId"
                                                                                                class="col-xs-8 col-sm-2"
                                                                                                datatype="require"
                                                                                                dc_select msg="选择数据分类"
                                                                                                style="margin-left: 20px;">
																							<option value="">-请选择数据分类-</option>
																							<c:forEach var="dc"
                                                                                                       items="${dataCatagories}">
                                                                                                <option value="${dc.id}"
                                                                                                        <c:if test="${vo.dateCategoryId eq dc.id}">selected="selected"</c:if>>${dc.name}</option>
                                                                                            </c:forEach>
																						</select> 
																						
																						<span class="lbl">&nbsp;</span> 
																					</span>
                                                                            </div>
                                                                        </div>
                                                                        <div class="profile-info-row"
                                                                             style="height: 45px;">
                                                                            <div class="profile-info-name"
                                                                                 style="padding-top: 15px;">选择数据源映射
                                                                            </div>
                                                                            <div class="profile-info-value">
																					<span class="editable"> 
																					<select id="ds_mapping" name="mpId"
                                                                                            class="col-xs-8 col-sm-2"
                                                                                            datatype="require"
                                                                                            msg="选择数据源映射"
                                                                                            onchange="changeTable(this.value);">
																							<option value="">-请选择数据源映射	-</option>
																							<c:forEach var="ds_mapping"
                                                                                                       items="${ds_mappings}">
                                                                                                <option value="${ds_mapping.id}"
                                                                                                        <c:if test="${vo.mpId eq ds_mapping.id}">selected="selected"</c:if>
                                                                                                        mptype="${ds_mapping.mappingType}">${ds_mapping.mappingName}</option>
                                                                                            </c:forEach>
																					</select>
																					<span class="lbl">&nbsp;</span> </span>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="widget-box transparent">
                                        <div class="widget-header">
                                            <h6 class="lighter blue">数据抽取配置</h6>
                                        </div>
                                        <br>
                                        <div class="row" id="conf_1" style="display: none;">
                                            <div class="col-xs-12" id="table_select_list">
                                                <div class="col-md-3">
                                                    <h4><span class="unselected-title" id="source_title"
                                                              style="font-size: small;">源端数据对象列表（共0个对象）</span></h4>
                                                    <select id="source" class="unselected form-control dual_select"
                                                            table_select style="height: 200px; width: 100%;"
                                                            multiple="multiple">

                                                    </select>
                                                </div>
                                                <div class="col-md-1 text-center"
                                                     style="margin-top: 80px; text-align: center;">
                                                    <button type="button" id="btnAllRight"
                                                            class="btn btn-white col-md-8 col-md-offset-2"
                                                            style="margin-bottom: 10px; margin-left: 10px;" disabled="">
                                                        >>
                                                    </button>
                                                    <br>
                                                    <button type="button" id="btnRight"
                                                            class="btn btn-white col-md-8 col-md-offset-2"
                                                            style="margin-bottom: 10px; margin-left: 10px;" disabled="">
                                                        >
                                                    </button>
                                                    <br>
                                                    <button type="button" id="btnLeft"
                                                            class="btn btn-white col-md-8 col-md-offset-2"
                                                            style="margin-bottom: 10px; margin-left: 10px;" disabled="">
                                                        <
                                                    </button>
                                                    <br>
                                                    <button type="button" id="btnAllLeft"
                                                            class="btn btn-white col-md-8 col-md-offset-2"
                                                            style="margin-bottom: 10px; margin-left: 10px;" disabled="">
                                                        <<
                                                    </button>
                                                    <br>
                                                </div>
                                                <div class="col-md-8" style="margin-top:-3px;">
                                                    <h4><span class="unselected-title" id="dest_title"
                                                              style="font-size: small;">已选择抽取对象列表（共0个对象）</span></h4>
                                                    <div style=" border:1px solid #d5d5d5;">
                                                        <div class="wrapper" style="height:200px; overflow-y:scroll;">
                                                            <table class="scroll table table-striped table-bordered table-hover"
                                                                   style="margin-bottom:0px;">
                                                                <thead>
                                                                <tr>
                                                                    <th class="center" width='5%'>
                                                                        <label>
                                                                            <input type="checkbox"
                                                                                   onclick="changeDestination(this)"
                                                                                   class="ace" id="checkedAll"/>
                                                                            <span class="lbl"></span>
                                                                        </label>
                                                                    </th>
                                                                    <th class="center" width='25%'>已选择表</th>
                                                                    <th class="center" width="15%">schema</th>
                                                                    <th class="center" width='13%'>有增量字段</th>
                                                                    <th class="center" width='13%'>字段信息</th>
                                                                    <th class="center" width='13%'>抽取区间</th>
                                                                    <th class="center" width='16%'>自定义过滤条件</th>
                                                                </tr>
                                                                </thead>
                                                                <tbody id="table_table_body">
                                                                </tbody>
                                                            </table>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div style="display:none">
                                                <h4><span class="selected-title">已选表</span></h4>
                                                <input id="filter_destination"
                                                       class="filter form-control filter-selected" type="text"
                                                       placeholder="请输入查询条件..." style="margin-bottom: 5px;">
                                                <select id="destination" class="selected form-control dual_select"
                                                        style="height: 200px; width: 100%;" multiple="multiple" name="">
                                                </select>
                                            </div>
                                        </div>
                                        <div class="row" id="conf_3" style="display: none;">
                                            <div class="table-responsive">
                                                <div class="row">
                                                    <div class="col-xs-12">
                                                        <div class="widget-main">
                                                            <div class="profile-user-info profile-user-info-striped">
                                                                <div class="profile-info-row">
                                                                    <div class="profile-info-name">目录过滤条件</div>
                                                                    <div class="profile-info-value">
																		<span class="editable">
																			<input type="checkbox" class="ace"
                                                                                   name="chlidDir" id="sendChlidDir"
                                                                                   value="1"
                                                                                   <c:if test="${filter.chlidDir eq 1}">checked='checked'</c:if>/>
																			<span class="lbl"> 发送子目录</span>
																		</span>
                                                                    </div>
                                                                </div>
                                                                <div class="profile-info-row">
                                                                    <div class="profile-info-name">文件过滤条件</div>
                                                                    <div class="profile-info-value">
																		<span class="editable">
																			<div class="profile-info-row">
																				<div class="profile-info-name">文件名</div>
																				<div class="profile-info-value">
																					<input name="filterType"
                                                                                           id="filterType1" type="radio"
                                                                                           class="ace" value="1"
                                                                                           <c:if test="${filter.filterType eq 1 }">checked='checked'  </c:if>
                                                                                           style="margin-top:10px;"/>
																					<span class="lbl">&nbsp;通配符</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
																					<input type="text"
                                                                                           name="filterValue1"
                                                                                           id="filterValue1" title="通配符"
                                                                                           placeholder="通配符"
                                                                                           maxlength="150"/>
																					<span class="tipMe"
                                                                                          title="星号(*)代表任意个数的字符串，问号(?)代表一个字符.当查找文件夹时，可以使用它来代替一个或多个真正字符；当不知道真正字符或者懒得输入完整名字时，可使用通配符代替一个或多个真正的字符。例：'*.txt'查找所有扩展名为.txt的文件；'abc?.txt'查找以abc开头的一个字符结尾，并扩展名为.txt的文件。"><a>帮助</a></span>
																				</div>
																				<div class="profile-info-value">
																					<input name="filterType"
                                                                                           id="filterType2" type="radio"
                                                                                           class="ace" value="2"
                                                                                           <c:if test="${filter.filterType eq 2 }">checked='checked'
                                                                                           </c:if>style="margin-top:10px;"/>
																					<span class="lbl">&nbsp;正则表达式</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
																					<input type="text"
                                                                                           name="filterValue2"
                                                                                           id="filterValue2"
                                                                                           title="正则表达式"
                                                                                           placeholder="正则表达式"
                                                                                           maxlength="150"/>
																					<span class="tipMe"
                                                                                          title="使用正则表达式过滤文件,例如：查找文件名以时间戳yyyyMMddHHmmss结尾的txt文件，则正则表达式为【\d{14}\.txt】"><a>帮助</a></span>
																				</div>
																				<input type="hidden" name="filterValue"
                                                                                       id="filterValue"
                                                                                       value="${filter.filterValue }"/>
																			</div>
																			<div class="profile-info-row">
																				<div class="profile-info-name">文件大小</div>
																				<div class="profile-info-value">
																					<span class="lbl">最小</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
																					<input type="text" name="sizeMin"
                                                                                           id="sizeMin" value="0"
                                                                                           style="width: 100px;"
                                                                                           value="${ filter.sizeMin}"/>
																					<span class="lbl">KB</span>
																				</div>
																				<div class="profile-info-value">
																					 <span class="lbl">最大</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
																						<input name="maxType"
                                                                                               id="maxType1"
                                                                                               type="radio" class="ace"
                                                                                               value="1"
                                                                                               <c:if test="${empty filter.sizeMax }">checked='checked'  </c:if>
                                                                                               style="margin-top:10px;"/>
																						<span class="lbl">&nbsp;无限制</span>&nbsp;&nbsp;&nbsp;
																						<input name="maxType"
                                                                                               id="maxType2"
                                                                                               type="radio" class="ace"
                                                                                               value="2"
                                                                                               <c:if test="${!empty filter.sizeMax }">checked='checked'  </c:if>
                                                                                               style="margin-top:10px;"/>
																						<span class="lbl">&nbsp;指定最大值&nbsp;</span>
																						<input type="text"
                                                                                               name="sizeMax"
                                                                                               id="sizeMax" value="0"
                                                                                               style="width: 100px;"
                                                                                               value="${ filter.sizeMax}"/>
																						<span class="lbl">KB</span>
																				</div>
																			</div>
																		</span>
                                                                    </div>
                                                                </div>
                                                                <!--
                                                                <div class="profile-info-row">
                                                                    <div class="profile-info-name"></div>
                                                                    <div class="profile-info-value">
                                                                        <span class="editable">
                                                                            <input name="sameDirPath"  id="sameDirPath" type="checkbox" class="ace"  value="1"/>
                                                                            <span class="lbl"> 文件到达目的目录后，保持子目录结构？</span>
                                                                        </span>
                                                                    </div>
                                                                </div>
                                                                 -->
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>


                                    <div class="widget-box transparent">
                                        <div class="widget-header">
                                            <h6 class="lighter blue">任务首次执行类型</h6>
                                        </div>

                                        <div class="widget-body">
                                            <div class="widget-main no-padding-left no-padding-right">
                                                <div class="row">
                                                    <div class="table-responsive">
                                                        <div class="row">
                                                            <div class="col-xs-12">
                                                                <div class="row"
                                                                     style="margin-left:20px; margin-bottom:4px;">
                                                                    <input name="taskFreqType" id="taskFreqType2"
                                                                           type="hidden" value="${taskType}"/>

                                                                    <input name="executeType" id="executeType1"
                                                                           type="radio" class="ace" value="1"
                                                                           <c:if test="${ontime.executeType eq 1 || period.executeType eq 1}">checked='checked' </c:if>
                                                                           style="margin-top:12px;"
                                                                           onclick="changeExecuteType();"/>
                                                                    <span class="lbl">&nbsp;立即执行</span>&nbsp;&nbsp;

                                                                    <input name="executeType" id="executeType2"
                                                                           type="radio" class="ace" value="2"
                                                                           <c:if test="${ontime.executeType eq 2 || period.executeType eq 2}">checked='checked' </c:if>
                                                                           style="margin-top:12px;"
                                                                           onclick="changeExecuteType();"/>
                                                                    <span class="lbl">&nbsp;手动执行</span> &nbsp;&nbsp;

                                                                    <input name="executeType" id="executeType3"
                                                                           type="radio" class="ace" value="3"
                                                                           <c:if test="${period.executeType eq 3 || ontime.executeType eq 3}">checked='checked' </c:if>
                                                                           style="margin-top:12px;"
                                                                           onclick="changeExecuteType();"/>
                                                                    <span class="lbl">&nbsp;定时执行</span> &nbsp;
                                                                    <input type="text" name="ontimeExecuteTime"
                                                                           id="ontimeExecuteTime" title="定时发送时间"
                                                                           placeholder="定时执行时间"
                                                                           style="width: 185px;margin-left: 10px;"
                                                                           <c:if test="${period.executeType eq 3}">value="${app:fmtDate(period.executeTime)}" </c:if>
                                                                           <c:if test="${ontime.executeType eq 3}">value="${app:fmtDate(ontime.executeTime)}" </c:if>
                                                                           onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
                                                                </div>


                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>


                                    <div class="widget-box transparent" id="freq_div">
                                        <div class="widget-header">
                                            <h6 class="lighter blue">任务执行频率</h6>
                                        </div>

                                        <div class="widget-body">
                                            <div class="widget-main no-padding-left no-padding-right">
                                                <div class="row">
                                                    <div class="table-responsive">
                                                        <div class="row">
                                                            <div class="col-xs-12">

                                                                <div class="profile-info-value"
                                                                     style="margin-left:14px; margin-bottom:4px;border-top:0;">
                                                                    <input name="intervalVallue" id="intervalVallue"
                                                                           type="hidden" value="">
                                                                    <input name="periodExecuteTime"
                                                                           id="periodExecuteTime" type="hidden"
                                                                           value="">
                                                                    <input name="freq" id="freq1" type="radio" value="1"
                                                                           class="ace"
                                                                           <c:if test="${period.freq eq 1}">checked="checked" </c:if>
                                                                           style="margin-top:10px;"/>
                                                                    <span class="lbl">&nbsp;间隔</span>&nbsp;&nbsp;
                                                                    <input type="text"
                                                                           style="height:30px;width: 40px;padding-top: 2px;"
                                                                           name="intervalVallue1" id="intervalVallue1"
                                                                           value="" title="间隔时间" placeholder="间隔"/>
                                                                    <select name="intervalVallue1Type"
                                                                            id="intervalVallue1Type">
                                                                        <option value="1">秒</option>
                                                                        <option value="60">分钟</option>
                                                                        <option value="3600">小时</option>
                                                                    </select>&nbsp;&nbsp;
                                                                    <span id="settSpan" style="display: none">														<input
                                                                            name="isSett" id="isSett" type="checkbox"
                                                                            class="ace" value="1"
                                                                            style="margin-top:12px;"
                                                                            onclick="checkIsSett();"/>
																								<span class="lbl">&nbsp;是否结算</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注：所有交换表增量字段必须为日期类型.</span>
                                                                </div>
                                                                <div class="profile-info-value"
                                                                     style="margin-left:14px;">
                                                                    <input name="freq" id="freq2" type="radio"
                                                                           class="ace" value="2"
                                                                           <c:if test="${period.freq eq 2}">checked="checked" </c:if>
                                                                           style="margin-top:10px;"/>
                                                                    <span class="lbl">&nbsp;每天</span>&nbsp;&nbsp;
                                                                    <input type="text"
                                                                           style="width: 185px;height:30px;padding-top: 2px;"
                                                                           id="executeTime2" title="任务执行时间"
                                                                           placeholder="执行时间" name="executeTime2"
                                                                           onfocus="WdatePicker({dateFmt:'HH:mm:ss'})"/>
                                                                </div>
                                                                <div class="profile-info-value"
                                                                     style="margin-left:14px;">
                                                                    <input name="freq" id="freq3" type="radio"
                                                                           class="ace" value="3"
                                                                           <c:if test="${period.freq eq 3}">checked="checked" </c:if>
                                                                           style="margin-top:10px;"/>
                                                                    <span class="lbl">&nbsp;每周</span>&nbsp;&nbsp;
                                                                    <select name="intervalVallue3" id="intervalVallue3">
                                                                        <option value="2">周一</option>
                                                                        <option value="3">周二</option>
                                                                        <option value="4">周三</option>
                                                                        <option value="5">周四</option>
                                                                        <option value="6">周五</option>
                                                                        <option value="7">周六</option>
                                                                        <option value="1">周日</option>
                                                                    </select>&nbsp;
                                                                    <input type="text"
                                                                           style="width: 185px;height:30px;padding-top: 2px;"
                                                                           id="executeTime3" title="任务执行时间"
                                                                           placeholder="执行时间" name="executeTime3"
                                                                           onfocus="WdatePicker({dateFmt:'HH:mm:ss'})"/>
                                                                </div>
                                                                <div class="profile-info-value"
                                                                     style="margin-left:14px;">
                                                                    <input name="freq" id="freq4" type="radio"
                                                                           class="ace" value="4"
                                                                           <c:if test="${period.freq eq 4}">checked="checked" </c:if>
                                                                           style="margin-top:10px;"/>
                                                                    <span class="lbl">&nbsp;每月</span> &nbsp;
                                                                    <select style="width: 60px;" name="intervalVallue4"
                                                                            id="intervalVallue4">
                                                                        <option value="1">1</option>
                                                                        <option value="2">2</option>
                                                                        <option value="3">3</option>
                                                                        <option value="4">4</option>
                                                                        <option value="5">5</option>
                                                                        <option value="6">6</option>
                                                                        <option value="7">7</option>
                                                                        <option value="8">8</option>
                                                                        <option value="9">9</option>
                                                                        <option value="10">10</option>
                                                                        <option value="11">11</option>
                                                                        <option value="12">12</option>
                                                                        <option value="13">13</option>
                                                                        <option value="14">14</option>
                                                                        <option selected value="15">15</option>
                                                                        <option value="16">16</option>
                                                                        <option value="17">17</option>
                                                                        <option value="18">18</option>
                                                                        <option value="19">19</option>
                                                                        <option value="20">20</option>
                                                                        <option value="21">21</option>
                                                                        <option value="22">22</option>
                                                                        <option value="23">23</option>
                                                                        <option value="24">24</option>
                                                                        <option value="25">25</option>
                                                                        <option value="26">26</option>
                                                                        <option value="27">27</option>
                                                                        <option value="28">28</option>
                                                                        <option value="29">29</option>
                                                                        <option value="30">30</option>
                                                                        <option value="31">31</option>
                                                                    </select>&nbsp;
                                                                    <input type="text"
                                                                           style="width: 185px;height:30px;padding-top: 2px;"
                                                                           id="executeTime4" title="任务执行时间"
                                                                           placeholder="执行时间" name="executeTime4"
                                                                           onfocus="WdatePicker({dateFmt:'HH:mm:ss'})"/>
                                                                </div>

                                                                <!-- <div class="profile-info-name" style="padding-top:12px;">截止时间</div> -->
                                                                <div class="profile-info-value"
                                                                     style="margin-left:14px;">
																								<span class="editable"> 
																									<input name="cutOffTimeType"
                                                                                                           id="cutOffTimeType1"
                                                                                                           type="radio"
                                                                                                           value="1"
                                                                                                           class="ace"
                                                                                                           <c:if test="${empty period.cutOffTime }">checked="checked" </c:if>
                                                                                                           onclick="changeCutOffTimeType(1);"
                                                                                                           style="margin-top:10px;"/>
																									<span class="lbl">&nbsp;无限制</span> 
																									<input name="cutOffTimeType"
                                                                                                           id="cutOffTimeType2"
                                                                                                           type="radio"
                                                                                                           value="2"
                                                                                                           class="ace"
                                                                                                           <c:if test="${! empty period.cutOffTime  }">checked="checked" </c:if>
                                                                                                           onclick="changeCutOffTimeType(2);"
                                                                                                           style="margin-top:10px;"/>
																									<span class="lbl">&nbsp;指定截止时间</span> &nbsp;
																									<input type="text"
                                                                                                           name="cutOffTime"
                                                                                                           id="cutOffTime"
                                                                                                           title="截止时间"
                                                                                                           placeholder="截止时间"
                                                                                                           style="width: 185px;height:30px;padding-top: 2px;"
                                                                                                           onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
																								</span>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <hr>
                                    <div class="clearfix form-group">
                                        <div class="col-md-offset-5 col-md-7">
                                            <button id="sbmBtn" type="submit" class="btn btn-sm btn-info"
                                                    id="sbmBtn">
                                                <i class="icon-ok bigger-110"></i>保存
                                            </button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div id="tempDiv" style="display: none;">
    <div class="modal-dialog modal-lg" style="width: 1200px;">
        <div class="modal-content" id="tableDiv">
        </div>
    </div>
</div>

<div id="WhereShowDiv" style="display: none;">
    <div class="modal-dialog modal-sm">
        <div class="modal-content" id="tableDiv_1">

            <div class="modal-body overflow-visible">
                <table class='table table-striped table-bordered table-hover'>
                    <thead>
                    <tr>
                        <th>发布条件</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td id="WhereCell">
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>

<div id="WhereEditDiv" style="display: none;">
    <div class="modal-dialog modal-sm">
        <div class="modal-content" id="tableDiv_2">

        </div>
    </div>
</div>

<div id="IntervalEditDiv" style="display: none;">
    <div class="modal-dialog modal-sm">
        <div class="modal-content" id="tableDiv_4">

        </div>
    </div>
</div>

<div id="IntervalShowDiv" style="display: none;">
    <div class="modal-dialog modal-xs">
        <div class="modal-content" id="tableDiv_5">

            <div class="modal-body overflow-visible">
                <table class='table table-striped table-bordered table-hover'>
                    <thead>
                    <tr>
                        <th>数据抽取起始值</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td id="StartValueCell">
                        </td>
                    </tr>
                    </tbody>
                </table>
                <table id="endValueTable" class='table table-striped table-bordered table-hover'>
                    <thead>
                    <tr>
                        <th>数据抽取截止值</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td id="EndValueCell">
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>

<div id="selectModalDiv" style="display: none;">
    <div class="modal-dialog modal-sm" style="width: 1200px;">
        <div class="modal-content" id="tableDiv_3">
        </div>
    </div>
</div>
</body>
</html>